package com.cskaoyan.day4;

public class TheJudgesScore {
    public static void main(String[] args) {
        double[] scores = {0, 100, 100, 80, 80, 80, 80, 0, 70, 70};
        System.out.println("最大值:" + getMaxValue(scores));
        System.out.println("最小值:" + getMinValue(scores));
        System.out.println("平均值:" + getAvgValue(scores));
    }

    public static double getMaxValue(double[] arr) {
        double min = arr[0];
        for (double v : arr) {
            if (v < min) {
                min = v;
            }
        }
        return min;
    }

    public static double getMinValue(double[] arr) {
        double max = arr[0];
        for (double v : arr) {
            if (v > max) {
                max = v;
            }
        }
        return max;
    }

    public static double getAvgValue(double[] arr) {
        int sum = 0;
        for (double v : arr) {
            sum += v;
        }
        return (sum - getMaxValue(arr) - getMinValue(arr)) / 8;
    }
}
